home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17302 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.2 KB

  1. Path: another.GUN.de!dexam
  2. From: dexam@another.gun.de (Thomas Fischbacher)
  3. X-Newsreader: MicroDot 1.10 
  4. Newsgroups: rec.games.programmer,comp.lang.c,comp.lang.c++
  5. Subject: Re: ! Read me and State your opinion.
  6. Date: Sat, 13 Apr 1996 18:44:53 +0200
  7. Message-ID: <xb$YlMD4ED1aez4@dexam.another.gun.de>
  8. References: <4kegoq$f2d$1@mhadg.production.compuserve.com>
  9. X-Gateway: ZCONNECT UT tron.gun.de [Z-NEWS 2.6/AMIGA]
  10.  
  11. On 09.04.1996 [20:19:38] [73627.2516@compuserve.com (Andrew T. Finnell)] wrote the following lines about
  12. "! Read me and State your opinion."
  13.  
  14. AF>  Hello all fellow C/C++ programmers.
  15.  
  16. AF>     I'd like your opinion on a subject. I recently had a 
  17. AF> argument with one of my friends and he says that C sucks and 
  18. AF> people shouldn't be programming in it and it's more of a hassel to 
  19. AF> program in. He also says that some better language will come out, 
  20. AF> not a add on like C to C++. I think he's full of it so does my 
  21. AF> dad. Yes I'm only 15. I am a pretty good programmer if I do say so 
  22. AF> myself. But my friend says it's to hard to learn and doesn't serve 
  23. AF> the purpose it's supposed too. As in the transportable code. He 
  24.  
  25. When I had been 15, my opinion was very similar to yours.
  26. It's always the same, regardless whether it's about hardware,
  27. operating systems, programming languages or whatever else - never judge
  28. without considerable practical experience with alternatives.
  29. Now that I have had opportunity to work with quite some rather "exotic"
  30. languages (from the viewpoint of a C programmer), my opinion has
  31. completely changed.
  32.  
  33. C certainly does play a very important role, no one can neglect this; so
  34. does C++ - with increasing impact.
  35. Though they have their strengths, both languages have some serious
  36. weaknesses so that I never would consider to use them for certain
  37. applications. Remember for example that there is virtually no support
  38. for recursive data structures. (As one would expect for a rather
  39. "low-level" language.)
  40. C/C++ also are full of tripwires; there is no standard size of int's,
  41. "integral promotions" can easily become very nasty, etc. Come on, there
  42. are FIFTEEN(!) different operator priorities you have to LEARN, because
  43. often they are not what you'd suspect. ("if(x & 0xff ==0xc0)"...)
  44.  
  45. Let's have a look at C++ exception handling for a moment: this "lately"
  46. introduced and extremely useful feature comes from a language of a
  47. completely different type. What do we learn from that?
  48.  
  49. AF> says there's not enough standard librarys as in Text output and 
  50. AF> graphics. I told him that that's why it is called a low-level 
  51.  
  52. OS libraries are of secondary interest when it's about the language.
  53.  
  54. AF>     I think that C/C++ won't be replace but "upgraded". I 
  55. AF> don't know how I can explain to him that C is the language to make 
  56. AF> programs. Also my friends brother is the main reason I wrote this. 
  57.  
  58. True for some special kinds of programs, but certainly not for all.
  59.  
  60. AF> He doesn't want to learn C because he thinks it will be replaced 
  61. AF> and he'll just have to learn a new language. 
  62.  
  63. Such an attitude will never carry you very far. Those who are
  64. willing and able to adapt to a big variety of situations usually do best.
  65.  
  66. AF>     Now I think C is awesome and most versitle. I love 
  67.  
  68. I'll give you a short sample code in SML. Tell me how many lines of
  69. C-code it would be worth. (And how difficult it would be to prove its
  70. correctness)
  71.  
  72. datatype TERM = num of real
  73.               | sum of TERM*TERM
  74.               | prod of TERM*TERM
  75.               | diff of TERM*TERM
  76.               | quot of TERM*TERM;
  77.  
  78. fun eval (num(x)) = x
  79.   | eval (sum(a,b)) = eval a + eval b
  80.   | eval (prod(a,b)) = eval a * eval b
  81.   | eval (diff(a,b)) = eval a - eval b
  82.   | eval (quot(a,b)) = eval a / eval b;
  83.  
  84. Example:
  85.  
  86. - val term1= prod(sum(num(1.0),num(2.8)),diff(num(2.0),num(3.6)));
  87. > val term1 = prod (sum (num 1.0,num 2.8),diff (num 2.0,num 3.6)) : TERM
  88. - eval term1;
  89. > ~6.0800000000000001 : real
  90.  
  91.  
  92. --
  93. regards,         Thomas Fischbacher - dexam@another.gun.de
  94.                                       fischbac@informatik.tu-muenchen.de
  95.  
  96. Microsoft Network is prohibited from redistributing this work in any form, in
  97. whole or in part.   License to distribute this post is available to Microsoft
  98. for $499. Posting without permission constitutes an agreement to these terms.
  99.  
  100.